<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="com.ys.malini.util.PagerContext"%>
<%@ taglib uri="/WEB-INF/tld/c.tld"  prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/pager-taglib.tld" prefix="pg"%>
<%@ page isELIgnored="false"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MALINI后台管理系统</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tabfont01 {	
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}
.font051 {font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}
.font201 {font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>

<link href="<%=request.getContextPath()%>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/calendar/Calendar1.js" language="javascript"></script>
</head>
<SCRIPT language=JavaScript>
function sousuo(){
	window.open("gaojisousuo.htm","","depended=0,alwaysRaised=1,width=800,height=510,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0");
}
function selectAll(){
	var obj = document.fom.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			obj[i].checked = true;
		}
	}
}

function unselectAll(){
	var obj = document.fom.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			if (obj[i].checked==true) obj[i].checked = false;
			else obj[i].checked = true;
		}
	}
}

function link(){
    document.getElementById("listform").action="addProduct.jsp";
    document.getElementById("listform").submit();
}

function search(){
    document.getElementById("listform").action="/malini/commodityAction.do?op=listCommodity";
    document.getElementById("listform").submit();
}
</SCRIPT>

<body>
<form name="listform" id="listform" method="post" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td height="30">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="62" background="<%=request.getContextPath()%>/images/back/nav04.gif">
            
		   <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		    <tr>
			  <td><img src="<%=request.getContextPath()%>/images/back/ico07.gif" width="20" height="18" />
			  <!--  
			  	</td>
			  	<td width="600">查看商品：按上架日期：
				<input onfocus="calendar()" name="startDate" type="text" id="startDate"/>
				<span class="newfont06">至</span>
				<input onfocus="calendar()" name="startDate" type="text" id="endDate"/>
				<input name="Submit4" type="button" class="right-button02" value="查 询" onclick="search()"/></td>
			   <td width="144" align="left"><a href="#" onclick="sousuo()">
			     <input name="Submit3" type="button" class="right-button07" value="高级搜索" />
			   </a></td>	
			   -->
		    </tr>
          </table></td>
        </tr>
    </table></td></tr>
  <tr>
    <td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
          	 <tr>
               <td height="20"><span class="newfont07">选择：<a href="#" class="right-font08" onclick="selectAll();">全选</a>-<a href="#" class="right-font08" onclick="unselectAll();">反选</a></span>
	              <input name="Submit" type="button" class="right-button08" value="删除所选商品" />
	              <input name="Submit2" type="button" class="right-button08" value="添加商品" onclick="link();"/>
	              <input name="Submit4" type="button" class="right-button02" value="查 询" onclick="search()"/></td>
          	 </tr>
              <tr>
                <td height="40" class="font42">
				<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
				  <tr bgcolor="#EEEEEE">
                    	<td height="22" colspan="9" align="center" >商品列表</td>
                  </tr>
                  <tr bgcolor="#EEEEEE">
				    <td width="4%" align="center" height="30">选择</td>
                    <td width="10%">商品名称</td>
					<td width="10%">产品类型</td>
					<td width="10%">主题</td>
                    <td width="10%">系列</td>
					<td width="10%">材质</td>
					<td width="5%">商品状态</td>
					<td width="10%">是否新品</td>
					<td width="12%">操作</td>
                  </tr>
                  <c:forEach items="${commodityList}" var="product"> 
	                  <tr bgcolor="#FFFFFF">
					    <td height="20"><input type="checkbox" name="${product.productId}"/></td>
	                    <td >${product.productName}</td>
						<td>
		                    <c:if test="${product.productType==0}">
		                     	组合
		                    </c:if>
		                    <c:if test="${product.productType==1}">
		                     	单个
		                    </c:if>
	                   	</td>
						<td>${product.title}</td>
	                    <td>${product.series}</td>
	                    <td>${product.material}</td>
	                    <td>
		                    <c:if test="${product.productStatus==0}">
		                     	下架
		                    </c:if>
		                    <c:if test="${product.productStatus==1}">
		                     	上架
		                    </c:if>
		                    <c:if test="${product.productStatus==2}">
		                     	已售完
		                    </c:if>
	                   	</td>
	                   	<td>
		                    <c:if test="${product.isNew==0}">
		                     	否
		                    </c:if>
		                    <c:if test="${product.isNew==1}">
		                     	是
		                    </c:if>
	                   	</td>
	                    <td><a href="/malini/commodityAction.do?op=updateCommodity&productId=${product.productId}">编辑|</a>
	                    	<a href=/malini/commodityAction.do?op=viewCommodity&productId=${product.productId}">查看|</a>
						<a href="javascript:if(confirm('确定删除吗?')){window.location='/malini/commodityAction.do?op=deleteCommodity&productId=${product.productId}';}">删除</a></td>
	                  </tr>
                  </c:forEach>
            </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
        <tr bgcolor="#EEEEEE">
          <td height="33"><div bgcolor="#EEEEEE">
		<TABLE width="100%">
				<TBODY>
					<TR class="list_hd">
						<TD height=28 align=right vAlign="middle" noWrap >
						总页数:<%=com.ys.malini.util.PagerContext.getTotal()/com.ys.malini.util.PagerContext.getPagesize()+1%>
							&nbsp;&nbsp;					
							<pg:pager url="/malini/commodityAction.do"							
								items="<%=PagerContext.getTotal()%>"							
								maxPageItems="<%=PagerContext.MAX_PAGE_SIZE%>"
								export="currentPageNumber=pageNumber" scope="request">
								<pg:param name="op" value="listCommodity"/>
								<pg:param name="b" value="1"/>
								<pg:param name="m" value="1"/>
								<pg:param name="s" value="1"/>
								<%@ include file="/pages/include/pager.jsp" %>
							</pg:pager>						
						</TD>
					</TR>
				</TBODY>
			</TABLE>
			
			</div></td>
        </tr>
      </table></td>
  </tr>
</table>
</form>
</body>
</html>
<%
	if(request.getAttribute("listMsg")!=null){
%>
	<script type="text/javascript">
		alert('<%=request.getAttribute("listMsg")%>');
	</script>
<%	
}
%>

